package top.lihope.error;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import top.lihope.respond.R;

/**
 * @description:
 * @ClassName: LXWExceptionAdvice
 * @author: 求求别学了，我跟不上
 * @email: xiwang.li@qq.com
 * @date： 2023/4/12 11:42
 * @version： 1.0
 */
@RestControllerAdvice
public class GlobalException {

    @ExceptionHandler(value = {StudentException.class})
    public R StudentException(Exception e){
        return R.error().setData(e.getMessage());
    }



    @ExceptionHandler(value = Exception.class)
    public R exception(Exception e){
        return R.error().setData(e.getMessage());
    }

}
